// src/tests/setup.ts
// 简化的测试设置文件

// 用于测试的通用工具函数
export const mockFn = (impl?: Function) => {
  const fn = (...args: any[]) => {
    if (impl) {
      return impl(...args);
    }
    return undefined;
  };
  fn.mock = {
    calls: [] as any[][],
    results: [] as any[]
  };
  return fn;
};

// 简单的测试工具
export const createMockElement = (tagName: string, attributes: Record<string, any> = {}) => {
  const element = document.createElement(tagName);
  Object.keys(attributes).forEach(key => {
    element.setAttribute(key, attributes[key]);
  });
  return element;
};

// 测试数据生成工具
export const generateMockData = <T>(count: number, generator: () => T): T[] => {
  return Array.from({ length: count }, generator);
};